Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

semver-truncate

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

semver-truncate

Truncate a semver version: 1.2.3 → 1.2.0

  • 1.1.2
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is semver-truncate?

The semver-truncate npm package is designed to truncate semantic versions to a specified level of precision. It can be used to manipulate version strings, allowing developers to easily reduce a full semantic version to just the major, minor, or patch component. This can be particularly useful in scenarios where software compatibility or versioning policies require simplified version strings.

What are semver-truncate's main functionalities?

Truncate to major version

This feature allows you to truncate a semantic version to its major component. It's useful when you need to reference or work with the major version of a dependency or project.

"const semverTruncate = require('semver-truncate');
console.log(semverTruncate('1.2.3', 'major')); // '1'"

Truncate to minor version

This feature enables truncation of a semantic version to include just the major and minor components, omitting the patch level. It can be useful for defining compatibility ranges or when minor version precision is required.

"const semverTruncate = require('semver-truncate');
console.log(semverTruncate('1.2.3', 'minor')); // '1.2'"

Truncate to patch version

This feature allows for the full semantic version string to be used, including the patch level. It's essentially a no-op in this context but can be used for consistency in code that dynamically selects the truncation level.

"const semverTruncate = require('semver-truncate');
console.log(semverTruncate('1.2.3', 'patch')); // '1.2.3'"

Other packages similar to semver-truncate

Keywords

FAQs

Package last updated on 04 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc